package com.hc.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hc.bean.PageBean;
import com.hc.domain.query.BrandQuery;
import com.hc.domain.vo.BrandVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.hc.mapper.BrandMapper;
import com.hc.domain.Brand;
import com.hc.service.BrandService;

import java.util.List;

/**
 * @ClassName:{NAME}
 * @Author:鹿建文
 * @Date:2022/5/16
 * @Describe:
 */
@Service("brandService")
public class BrandServiceImpl implements BrandService {

    @Resource
    private BrandMapper brandMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return brandMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Brand record) {
        return brandMapper.insert(record);
    }

    @Override
    public int insertSelective(Brand record) {
        return brandMapper.insertSelective(record);
    }

    @Override
    public Brand selectByPrimaryKey(Integer id) {
        return brandMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Brand record) {
        return brandMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Brand record) {
        return brandMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageBean<BrandVO> getPage(BrandQuery brandQuery, Integer pageNum, Integer pageSize) {
        Page<BrandVO> page = PageHelper.startPage(pageNum, pageSize);
        brandMapper.selectList(brandQuery);
        PageBean<BrandVO> pageBean = new PageBean<>(page);
        return pageBean;
    }

}

